import request from '@/utils/request'

// Get featured cases for homepage
export function getFeaturedCases(params) {
  return request({
    url: '/system/case/featured',
    method: 'get',
    params
  })
}

// Get case list with pagination (public API)
export function getCaseList(params) {
  return request({
    url: '/system/case/api/cases',
    method: 'get',
    params
  })
}

// Get case detail (public API)
export function getCaseDetail(id) {
  return request({
    url: `/system/case/api/cases/${id}`,
    method: 'get'
  })
}

// Create new case (requires authentication)
export function createCase(data) {
  return request({
    url: '/system/case',
    method: 'post',
    data,
    headers: {
      'Authorization': uni.getStorageSync('token')
    }
  })
}

// Update case (requires authentication)
export function updateCase(id, data) {
  return request({
    url: `/system/case`,
    method: 'put',
    data,
    headers: {
      'Authorization': uni.getStorageSync('token')
    }
  })
}

// Delete case (requires authentication)
export function deleteCase(id) {
  return request({
    url: `/system/case/${id}`,
    method: 'delete',
    headers: {
      'Authorization': uni.getStorageSync('token')
    }
  })
} 